#ifndef INSTRUCTION_H
#define INSTRUCTION_H

#include <string.h>
#include "type.h"

#define INSTRUCTION_WORDS 4096
#define INSTRUCTION_MASK INSTRUCTION_WORDS - 1

/*
	 utility functions to load and clear instruction memory
*/
int load_instruction (word *buf, int size);
int clear_instruction (void);

/*
	 accessor function to get an instruction word from instruction memory
*/
word fetch (word address);

/*
	 decode the instruction word
*/
void decode (const word instruction, word *opcode, word *creg, word *areg, word *breg, word *im22, word *im18);

#endif

